﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SubSonic;

namespace AppBox.admin
{
    public partial class log_view : PageBase
    {
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        #region Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            btnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference();

            int id = GetQueryIntValue("id");
            XLog log = XLog.FetchByID(id);
            if (log == null)
            {
                // 参数错误，首先弹出Alert对话框然后关闭弹出窗口
                ExtAspNet.Alert.Show("参数错误！", String.Empty, ExtAspNet.ActiveWindow.GetHideReference());
                return;
            }

            labDateTime.Text = log.DatetimeX.ToString("yyyy-MM-dd HH:mm:ss");
            labException.Text = log.Exception;
            labId.Text = log.Logid.ToString();
            labLevel.Text = log.LogLevel;
            labMessage.Text = log.Message;
            labSource.Text = log.Logger;
        }

        #endregion

        #region Events

        #endregion

    }
}
